package com.monitor.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.monitor.dao.ErpUserMapper;
import com.monitor.entity.ErpUser;
import com.monitor.service.ErpUserService;
import com.monitor.util.Result;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author LX
 * @since 2018-09-05
 */
@Service
@Transactional
public class ErpUserServiceImpl extends ServiceImpl<ErpUserMapper, ErpUser> implements ErpUserService {
	@Resource
	private ErpUserMapper erpUserMapper;
	
	@Override
	public Result<Integer> updateStutes(int id, int states) {
		// TODO Auto-generated method stub
		try {
			ErpUser user=erpUserMapper.selectById(id);
			user.setStatus(states);
			int count=erpUserMapper.updateAllColumnById(user);
			return new Result<Integer>(count, 1);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return new Result<>(1, e.getMessage());
		}
	}

}
